import React ,{useState,useEffect}from 'react'
import { Tabs } from 'antd';
import type { TabsProps } from 'antd';
import axios from 'axios';

const Index = () => {
  const onChange = (key: string) => {
    console.log(key);
  };
  const items: TabsProps['items'] = [
    {
      key: '1',
      label: '全部订单',
      children: 'Content of Tab Pane 1',
    },
    {
      key: '2',
      label: '代付款',
      children: 'Content of Tab Pane 2',
    },
    {
      key: '3',
      label: '待收货',
      children: 'Content of Tab Pane 3',
    },
  ];
  const [list,setList]=useState([])
  const GetList=async()=>{
    const res=await axios.get('api/article/list')
    console.log(res);
    setList(res.data.rows)
    
  }
  useEffect(()=>{
    GetList()
  },[])
  return (
    <div>
      <Tabs defaultActiveKey="1" items={items} onChange={onChange} />
      <div>
        {
          list.map((item:any)=>(
            <div key={item.id}>
              <div>{item.title}</div>
              <div>{item.content}</div>
            </div>
          ))
        }
      </div>
    </div>
  )
}

export default Index
